// 导入 api
import axios from './api'

/* 将所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 * 此处的数据依然来自 Easy Mock
 */

export const getCertificateInfoByUUID = data => {
  return axios({

    url: '/certificate/search',
    method: 'post',
    data
  })
};

// 区分一下baseURL osredm  为红山的接口 到时候需要在nginx上进行配置转发

export const getValidPhone = data => {
  return axios({
    baseURL: '/osredm',
    url: '/accounts/valid_email_and_phone.json',
    method: 'get',
    params: data
  })
}

export const sendCode = data => {
  return axios({
    baseURL: '/osredm',
    url: '/accounts/get_verification_code.json',
    method: 'get',
    params: data
  })
}

export const regInsert = data => {
  return axios({
    url: '/reg/insert',
    method: 'post',
    data
  })
}

export const selectByName = data => {
  return axios({
    url: '/reg/selectByName',
    method: 'post',
    params:data
  })
}

export const regOsredm = data => {
  return axios({
    baseURL: '/osredm',
    url: '/accounts/register.json',
    method: 'post',
    data
  })
}
// 默认全部倒出
// 根据需要进行
export default {
  getCertificateInfoByUUID,
  getValidPhone,
  sendCode,
  regOsredm,
  regInsert,
  selectByName
}
